﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.Shell.Interop;
using System.Runtime.InteropServices;

namespace FSharpInterrogator
{
    public class VsServiceProvider : Microsoft.VisualStudio.OLE.Interop.IServiceProvider
    {
        public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject)
        {
            if (guidService == typeof(SProfferService).GUID)
            {
                ppvObject = Marshal.GetIUnknownForObject(new VsProfferService());
            }
            else if (guidService == typeof(SUIHostLocale).GUID)
            {
                ppvObject = Marshal.GetIUnknownForObject(new VsUIHostLocale());
            }
            else if (guidService == typeof(SVsSolution).GUID)
            {
                ppvObject = Marshal.GetIUnknownForObject(new VsSolution());
            }
            else if (guidService == typeof(SVsRegisterProjectTypes).GUID)
            {
                ppvObject = Marshal.GetIUnknownForObject(new VsRegisterProjectTypes());
            }
            else
            {
                ppvObject = IntPtr.Zero;

                return 1;
            }

            return 0;
        }
    }
}
